<html>
<head><meta charset="utf-8"><title>meeting 2019-10-16 · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html">meeting 2019-10-16</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="178313784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178313784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178313784">(Oct 16 2019 at 18:06)</a>:</h4>
<p>Oh hai <span class="user-group-mention" data-user-group-id="692">@WG-traits</span> -- so this week has sort of been a mess, but let's try to have some sort of design meeting <em>anyway</em>!</p>



<a name="178313842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178313842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178313842">(Oct 16 2019 at 18:06)</a>:</h4>
<p>Couple of things:</p>



<a name="178313850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178313850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178313850">(Oct 16 2019 at 18:06)</a>:</h4>
<p>I won't be able to do this time after all</p>



<a name="178313862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178313862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178313862">(Oct 16 2019 at 18:07)</a>:</h4>
<p>I think Monday would work better for me</p>



<a name="178313880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178313880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178313880">(Oct 16 2019 at 18:07)</a>:</h4>
<p>Though I might be able to do a different time on Wednesday</p>



<a name="178313919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178313919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178313919">(Oct 16 2019 at 18:07)</a>:</h4>
<p>The question is -- what should we talk about -- I had hope to have a bit of a "presentation" on this, but as I said, this week has had a lot of last minute things coming up and I have just not had time.</p>



<a name="178313929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178313929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178313929">(Oct 16 2019 at 18:07)</a>:</h4>
<p>But let me float some of the things on my mind :)</p>



<a name="178314010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314010">(Oct 16 2019 at 18:08)</a>:</h4>
<ul>
<li>Lazy norm of constants in rustc  -- I think I see a way forward here to make concrete progress, could talk a bit about that</li>
</ul>



<a name="178314071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314071">(Oct 16 2019 at 18:09)</a>:</h4>
<ul>
<li>Improving lowering and changing a bit how types are represented in chalk</li>
</ul>



<a name="178314102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314102">(Oct 16 2019 at 18:09)</a>:</h4>
<ul>
<li>Related: extract a shared type library, what would that look like?</li>
</ul>



<a name="178314208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314208">(Oct 16 2019 at 18:10)</a>:</h4>
<ul>
<li>Universes in Rustc -- though I really haven't though much about that PR</li>
</ul>



<a name="178314217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314217">(Oct 16 2019 at 18:10)</a>:</h4>
<p>I guess the root question is "chalk or rustc"?</p>



<a name="178314239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314239">(Oct 16 2019 at 18:10)</a>:</h4>
<p>Given the folks who <span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span>'d above, maybe chalk?</p>



<a name="178314251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314251">(Oct 16 2019 at 18:10)</a>:</h4>
<p>(In the future, I'd like to pick topics for next time ahead of time)</p>



<a name="178314334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314334">(Oct 16 2019 at 18:11)</a>:</h4>
<p>also, here is a <a href="https://hackmd.io/ogm3gZM-RxiJBVSyO2z_qg" target="_blank" title="https://hackmd.io/ogm3gZM-RxiJBVSyO2z_qg">hackmd</a> for taking notes and the like</p>



<a name="178314337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314337">(Oct 16 2019 at 18:11)</a>:</h4>
<p>I think extracting a shared type library would be really interesting, sounds challenging though</p>



<a name="178314351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314351">(Oct 16 2019 at 18:11)</a>:</h4>
<p>Oops, wrong topic</p>



<a name="178314363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314363">(Oct 16 2019 at 18:11)</a>:</h4>
<p>oh wait</p>



<a name="178314370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314370">(Oct 16 2019 at 18:12)</a>:</h4>
<p>did I just mergr those two topics completely</p>



<a name="178314392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314392">(Oct 16 2019 at 18:12)</a>:</h4>
<p>dang it :)</p>



<a name="178314429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314429">(Oct 16 2019 at 18:12)</a>:</h4>
<p>oh, no, I didn't, <em>shew</em></p>



<a name="178314435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314435">(Oct 16 2019 at 18:12)</a>:</h4>
<blockquote>
<p>Oops, wrong topic</p>
</blockquote>
<p>yeah I retopic'd :)</p>



<a name="178314452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314452">(Oct 16 2019 at 18:12)</a>:</h4>
<p>ok, well, let's talk about "shared type libary" and "changing how types are represented in chalk"</p>



<a name="178314456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314456">(Oct 16 2019 at 18:12)</a>:</h4>
<p>they kind of overlap</p>



<a name="178314487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314487">(Oct 16 2019 at 18:12)</a>:</h4>
<p>let me just lay out a few strands to start</p>



<a name="178314511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314511">(Oct 16 2019 at 18:13)</a>:</h4>
<p>one of the things I would like to do is to change how we handle normalization and unifiation in chalk</p>



<a name="178314538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314538">(Oct 16 2019 at 18:13)</a>:</h4>
<p>right now, we have a type that represents an "unnormalized trait projection", like <code>&lt;T as Iterator&gt;::Item</code></p>



<a name="178314576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314576">(Oct 16 2019 at 18:13)</a>:</h4>
<p>our unification logic understands what this means</p>



<a name="178314664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314664">(Oct 16 2019 at 18:14)</a>:</h4>
<p>so if we try to unify <code>&lt;T as Iterator&gt;::Item</code> with some other type <code>U</code>, that "always succeeds", but it generates a pending obligation of the form <code>ProjectionEq(&lt;T as Iterator&gt;::Item = U)</code></p>



<a name="178314711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314711">(Oct 16 2019 at 18:14)</a>:</h4>
<p>that notation is maybe a <em>touch</em> confusing -- but basically the idea is that you have to prove that <code>&lt;T as Iterator&gt;::Item</code> can be 'normalized<code> to </code>U` based on the impls around</p>



<a name="178314754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314754">(Oct 16 2019 at 18:15)</a>:</h4>
<p>this is sort of a weird special case since most of unify is about proving that two types are <em>syntactically equal</em> (well, modulo regions)</p>



<a name="178314778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314778">(Oct 16 2019 at 18:15)</a>:</h4>
<p>it's also a bit of a divergence from "prolog", where unification is all about syntactic equality</p>



<a name="178314793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314793">(Oct 16 2019 at 18:15)</a>:</h4>
<p>(make sense so far?)</p>



<a name="178314915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314915">(Oct 16 2019 at 18:16)</a>:</h4>
<p>so why do I care?</p>



<a name="178314934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314934">(Oct 16 2019 at 18:16)</a>:</h4>
<p>well, for one thing, I want to lower as much as possible to something that resembles a simple prolog-liek thing</p>



<a name="178314937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314937">(Oct 16 2019 at 18:17)</a>:</h4>
<p>but also if we have an impl like this one:</p>



<a name="178314950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314950">(Oct 16 2019 at 18:17)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">T</span>::<span class="n">Item</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">..</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="178314972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314972">(Oct 16 2019 at 18:17)</a>:</h4>
<p>er, that's not the problem, sorry</p>



<a name="178314990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314990">(Oct 16 2019 at 18:17)</a>:</h4>
<p>well, if you're trying to prove a goal like <code>Implemented(&lt;T as Iterator&gt;::Item)</code> --</p>



<a name="178314996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178314996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178314996">(Oct 16 2019 at 18:17)</a>:</h4>
<p>(where that is not normalized)</p>



<a name="178315021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315021">(Oct 16 2019 at 18:18)</a>:</h4>
<p>sorry, maybe <code>Implemented(&lt;T as Iterator&gt;::Item: Foo)</code></p>



<a name="178315063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315063">(Oct 16 2019 at 18:18)</a>:</h4>
<p>anyway you have no idea what the self type <em>is</em></p>



<a name="178315074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315074">(Oct 16 2019 at 18:18)</a>:</h4>
<p>beacuse it unifies with anything</p>



<a name="178315077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315077">(Oct 16 2019 at 18:18)</a>:</h4>
<p>but likely it is quite a bit more constrained than that :)</p>



<a name="178315095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315095">(Oct 16 2019 at 18:18)</a>:</h4>
<p>we are currently floundering if we have a goal like <code>Implemented(?X: Foo)</code> -- i.e., where self-type is fully unknown</p>



<a name="178315108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315108">(Oct 16 2019 at 18:18)</a>:</h4>
<p>anyway so what I would like to do is to remove "unnormalized" projections</p>



<a name="178315118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315118">(Oct 16 2019 at 18:18)</a>:</h4>
<p>as a type</p>



<a name="178315136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315136">(Oct 16 2019 at 18:19)</a>:</h4>
<p>and instead just have "placeholder" ones -- actually kind of like rustc in this regard</p>



<a name="178315142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315142">(Oct 16 2019 at 18:19)</a>:</h4>
<p>but I'd like to <em>move</em> that normalization to the lowering phase</p>



<a name="178315155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315155">(Oct 16 2019 at 18:19)</a>:</h4>
<p>so if we have </p>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span>: <span class="nb">Iterator</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">T</span>::<span class="n">Item</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">..</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="178315194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315194">(Oct 16 2019 at 18:19)</a>:</h4>
<p>today we would generate a lowered rule like</p>
<div class="codehilite"><pre><span></span>forall&lt;T: Iterator&gt; {
    Implemented(&lt;T as Iterator&gt;::Item: Foo)
}
</pre></div>



<a name="178315261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315261">(Oct 16 2019 at 18:20)</a>:</h4>
<blockquote>
<p>and instead just have "placeholder" ones -- actually kind of like rustc in this regard</p>
</blockquote>
<p>(I'll use the notation <code>(Iterator::Item)&lt;T&gt;</code> for those, since that is what we use in chalk)</p>



<a name="178315272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315272">(Oct 16 2019 at 18:20)</a>:</h4>
<p>I'd prefer to generate this rule</p>



<a name="178315301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315301">(Oct 16 2019 at 18:20)</a>:</h4>
<div class="codehilite"><pre><span></span>forall&lt;T: Iterator, U&gt; {
    Implemented(U: Foo) :-
        ProjectionEq(&lt;T as Iterator&gt;::Item = U)
}
</pre></div>



<a name="178315324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315324">(Oct 16 2019 at 18:21)</a>:</h4>
<p>in a sense I've just "unrolled" what unification would have done anyway</p>



<a name="178315336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315336">(Oct 16 2019 at 18:21)</a>:</h4>
<p>(does that make sense?)</p>



<a name="178315447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315447">(Oct 16 2019 at 18:22)</a>:</h4>
<p>my impression is that this wasn’t done in the first place because it made the rules less ergonomic, is that right?</p>



<a name="178315495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315495">(Oct 16 2019 at 18:23)</a>:</h4>
<p>yeah, so, I've thought about it before; it obviously moves the lowered form a bit farther from Rust surface syntax</p>



<a name="178315506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315506">(Oct 16 2019 at 18:23)</a>:</h4>
<p>it's also just kind of a bit of a pain to implement with the system as it is</p>



<a name="178315518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315518">(Oct 16 2019 at 18:23)</a>:</h4>
<p>(which is part of what connects this to a shared type libary)</p>



<a name="178315555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315555">(Oct 16 2019 at 18:23)</a>:</h4>
<p>in particular, the user basically <em>writes</em> types that include unnormalized projections</p>



<a name="178315630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315630">(Oct 16 2019 at 18:24)</a>:</h4>
<p>today, we can kind of lower the user's types and embed them directly into the final rules -- actually, in the clause generating code, the "types" from user are <code>chalk_ir::Ty</code></p>



<a name="178315638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315638">(Oct 16 2019 at 18:24)</a>:</h4>
<p>so we can literally just embed them into the clauses we build</p>



<a name="178315662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315662">(Oct 16 2019 at 18:25)</a>:</h4>
<p>but what we have to do now is to say "if this type is an unnormalizd projection, instead we generate a fresh variable and some new clauses" etc</p>



<a name="178315668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315668">(Oct 16 2019 at 18:25)</a>:</h4>
<p>it's not <em>hard</em> per se but it's a bit more complex than before</p>



<a name="178315673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315673">(Oct 16 2019 at 18:25)</a>:</h4>
<p>but I'm not very happy with the clause generator code <em>anyway</em></p>



<a name="178315687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315687">(Oct 16 2019 at 18:25)</a>:</h4>
<p>it's super opaque, particularly around debruijn binders, and I think nobody gets it</p>



<a name="178315718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315718">(Oct 16 2019 at 18:25)</a>:</h4>
<p>so what I was thinking is this</p>



<a name="178315802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315802">(Oct 16 2019 at 18:26)</a>:</h4>
<p>first off, it seems like we sort of want two concepts of types</p>



<a name="178315812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315812">(Oct 16 2019 at 18:26)</a>:</h4>
<p>"pre-lowering" (which only includes unnormalized projections)</p>



<a name="178315825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315825">(Oct 16 2019 at 18:26)</a>:</h4>
<p>"clauses" (which never does)</p>



<a name="178315837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315837">(Oct 16 2019 at 18:27)</a>:</h4>
<p>at least <em>conceptually</em> we want that</p>



<a name="178315877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315877">(Oct 16 2019 at 18:27)</a>:</h4>
<p>and converting between the two is something you have to do carefully</p>



<a name="178315887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178315887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178315887">(Oct 16 2019 at 18:27)</a>:</h4>
<p>I'd like to use generic types for this, I think</p>



<a name="178316019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316019">(Oct 16 2019 at 18:29)</a>:</h4>
<p>so, in a sense, we're moving the complexity of these unnormalized projections out of unification and into the "pre-lowering =&gt; clauses" step?</p>



<a name="178316023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316023">(Oct 16 2019 at 18:29)</a>:</h4>
<p>so that we hvae some generic type <code>T: RustType</code> or something -- and some operations to (e.g.) figure out which variant of rust type it is. Probably there is a little "family"</p>
<div class="codehilite"><pre><span></span><span class="k">trait</span><span class="w"> </span><span class="n">RustTypeFamily</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Type</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Substitutions</span><span class="p">;</span><span class="w"></span>

<span class="w">    </span><span class="k">fn</span> <span class="nf">variant</span><span class="p">(</span><span class="n">Self</span>::<span class="n">Type</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">TypeVariants</span><span class="o">&lt;</span><span class="n">F</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">enum</span> <span class="nc">TypeVariants</span><span class="o">&lt;</span><span class="n">F</span>: <span class="nc">RustTypeFamily</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Apply</span><span class="p">(</span><span class="n">AppicationTy</span><span class="p">,</span><span class="w"> </span><span class="n">F</span>::<span class="n">Substitutions</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="178316034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316034">(Oct 16 2019 at 18:29)</a>:</h4>
<blockquote>
<p>so, in a sense, we're moving the complexity of these unnormalized projections out of unification and into the "pre-lowering =&gt; clauses" step?</p>
</blockquote>
<p>yes, exactly</p>



<a name="178316053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316053">(Oct 16 2019 at 18:29)</a>:</h4>
<p>there are a few reasons to use generics</p>



<a name="178316061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316061">(Oct 16 2019 at 18:29)</a>:</h4>
<p>but one of them that is nice is that</p>



<a name="178316129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316129">(Oct 16 2019 at 18:30)</a>:</h4>
<p>it might be that both the "before" and "after" types are represented by the same thing</p>



<a name="178316135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316135">(Oct 16 2019 at 18:30)</a>:</h4>
<p>but the <em>semantics</em> (particularly of projections!) are different</p>



<a name="178316146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316146">(Oct 16 2019 at 18:30)</a>:</h4>
<p>and if they have different generic types, then compiler can help us keep them separated</p>



<a name="178316156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316156">(Oct 16 2019 at 18:30)</a>:</h4>
<p>in particular, when we lower from a <code>BeforeType</code> to an <code>AfterType</code>, if it is a projection, we can generate the clauses we need</p>



<a name="178316213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316213">(Oct 16 2019 at 18:31)</a>:</h4>
<p>i.e., there'd be something like</p>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">lower_type</span><span class="p">(</span><span class="n">before</span>: <span class="kp">&amp;</span><span class="nc">Before</span>::<span class="n">Type</span><span class="p">,</span><span class="w"> </span><span class="n">obligations</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="nb">Vec</span><span class="o">&lt;</span><span class="n">Goal</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">After</span>::<span class="n">Type</span><span class="w"></span>
</pre></div>



<a name="178316234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316234">(Oct 16 2019 at 18:31)</a>:</h4>
<p>so now if I see a projection, I can generate the <code>ProjectionEq(...)</code> goal and push it onto <code>obligations</code></p>



<a name="178316246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316246">(Oct 16 2019 at 18:31)</a>:</h4>
<p>this is exactly what unify <em>used</em> to be doing at runtime</p>



<a name="178316292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316292">(Oct 16 2019 at 18:32)</a>:</h4>
<p>but we're doing it at clause generation time</p>



<a name="178316307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316307">(Oct 16 2019 at 18:32)</a>:</h4>
<p>/me pauses to see if folks have questions</p>



<a name="178316416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316416">(Oct 16 2019 at 18:34)</a>:</h4>
<p>ok</p>



<a name="178316467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316467">(Oct 16 2019 at 18:34)</a>:</h4>
<p>/me typing</p>



<a name="178316471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316471">(Oct 16 2019 at 18:34)</a>:</h4>
<p>heh :)</p>



<a name="178316474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316474">(Oct 16 2019 at 18:34)</a>:</h4>
<p>/me waits more</p>



<a name="178316509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316509">(Oct 16 2019 at 18:34)</a>:</h4>
<p>what you just said makes sense. just to build on my summary from before... the reason for moving all of this out of unification is so that we don't encounter so much complexity with regards to clause/goal selection and floundering?</p>



<a name="178316550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316550">(Oct 16 2019 at 18:35)</a>:</h4>
<p>yes, I have a few motivations</p>



<a name="178316556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316556">(Oct 16 2019 at 18:35)</a>:</h4>
<p>that is one of them</p>



<a name="178316580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316580">(Oct 16 2019 at 18:35)</a>:</h4>
<p>I also want to try and align our "lowered representation" with something that is closer to prolog because -- long term -- I want to make some kind of virtual machine to efficiently execute this stuff</p>



<a name="178316652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316652">(Oct 16 2019 at 18:36)</a>:</h4>
<p>and if unification looks more like "syntactic equality" and less like "a mini interpreter", that will be easier</p>



<a name="178316748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316748">(Oct 16 2019 at 18:37)</a>:</h4>
<p>another reason is that I think it should be a touch more efficient, and it's also maybe a better strategy long term for managing projections -- I'm not sure how true this , I guess. There are some other issues around the normalization strategy that chalk is using that suggests we <em>may</em> want to try to have some kind of "normalization function" more like what rust does --</p>



<a name="178316806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316806">(Oct 16 2019 at 18:38)</a>:</h4>
<p>/me is taking off and might not be as responsive, fyi</p>



<a name="178316810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316810">(Oct 16 2019 at 18:38)</a>:</h4>
<p>I guess I think that any such changes will be easier if we separate out the "projection-eq" part more cleanly, so that types are simpler</p>



<a name="178316839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316839">(Oct 16 2019 at 18:38)</a>:</h4>
<p>anyway, the connection that all this has to a "generic definition fo types" that can be shared is</p>



<a name="178316849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316849">(Oct 16 2019 at 18:38)</a>:</h4>
<p>well, I already started to give you what one might look like</p>



<a name="178316866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316866">(Oct 16 2019 at 18:38)</a>:</h4>
<blockquote>
<p>so that we hvae some generic type <code>T: RustType</code> or something -- and some operations to (e.g.) figure out which variant of rust type it is. Probably there is a little "family"</p>
<div class="codehilite"><pre><span></span><span class="k">trait</span><span class="w"> </span><span class="n">RustTypeFamily</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Type</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Substitutions</span><span class="p">;</span><span class="w"></span>

<span class="w">    </span><span class="k">fn</span> <span class="nf">variant</span><span class="p">(</span><span class="n">Self</span>::<span class="n">Type</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">TypeVariants</span><span class="o">&lt;</span><span class="n">F</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">enum</span> <span class="nc">TypeVariants</span><span class="o">&lt;</span><span class="n">F</span>: <span class="nc">RustTypeFamily</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Apply</span><span class="p">(</span><span class="n">AppicationTy</span><span class="p">,</span><span class="w"> </span><span class="n">F</span>::<span class="n">Substitutions</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


</blockquote>



<a name="178316893"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316893" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316893">(Oct 16 2019 at 18:39)</a>:</h4>
<p>so in this case we are not specifying the <em>structures per se</em> but rather a kind of trait</p>



<a name="178316907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316907">(Oct 16 2019 at 18:39)</a>:</h4>
<p>we'll need a few more operations (e.g., to "intern")</p>



<a name="178316923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316923">(Oct 16 2019 at 18:39)</a>:</h4>
<p>I have to do a bit of work to define that trait, what I wrote up there isn't <em>quite</em> it, there is a bit more</p>



<a name="178316930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316930">(Oct 16 2019 at 18:39)</a>:</h4>
<p>notably I thikn it's generic over the <code>ApplicationTy</code>, for example</p>



<a name="178316949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316949">(Oct 16 2019 at 18:39)</a>:</h4>
<p>but then I think we can implement this for Rust and have the type (internally) be <code>Ty&lt;'tcx&gt;</code></p>



<a name="178316962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178316962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178316962">(Oct 16 2019 at 18:40)</a>:</h4>
<p>and rust-analyzer can implement it and have types be "whatever"</p>



<a name="178317034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317034">(Oct 16 2019 at 18:40)</a>:</h4>
<p>and we can make all the logic in chalk-solve and friends kind of generic over that</p>



<a name="178317082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317082">(Oct 16 2019 at 18:40)</a>:</h4>
<p>I was hoping to start playing with this before the meeting but .. yeah .. life</p>



<a name="178317131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317131">(Oct 16 2019 at 18:41)</a>:</h4>
<p>I think though that chalk's "core variants" are probably about right, though we may want to tweak how they are structured</p>



<a name="178317163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317163">(Oct 16 2019 at 18:41)</a>:</h4>
<p>note also that the <code>variant</code> method can "convert" on the fly from rustc's <code>Ty</code> representation to a chalk one, at least at first -- probably we'd want them to match up as closely as possibly eventually</p>



<a name="178317230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317230">(Oct 16 2019 at 18:42)</a>:</h4>
<p>some random thoughts that I've been wondering about:</p>



<a name="178317235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317235">(Oct 16 2019 at 18:42)</a>:</h4>
<h1>debruijn or not?</h1>



<a name="178317280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317280">(Oct 16 2019 at 18:43)</a>:</h4>
<p>I love me some debruijn indices but .. they're also kind of confusing. Maybe it'd be better to just use "uuids" or something for each binding spot? (And disallow shadowing) In particular I think we could make the clause generation stuff a lot more ergonomic</p>



<a name="178317341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317341">(Oct 16 2019 at 18:43)</a>:</h4>
<h1>how would we actually <em>implement</em> this transition is another good question</h1>



<a name="178317418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317418">(Oct 16 2019 at 18:44)</a>:</h4>
<p>I have to think about the exact steps but I guess the right way to start would be to try and introduce a trait first, making things more and more generic over said trait, but keeping the same underlying types</p>



<a name="178317477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317477">(Oct 16 2019 at 18:45)</a>:</h4>
<p>but this all feels like stuff that's a bit hard to dig into in the abstract</p>



<a name="178317488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317488">(Oct 16 2019 at 18:45)</a>:</h4>
<p>easier with an open editor :)</p>



<a name="178317519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317519">(Oct 16 2019 at 18:45)</a>:</h4>
<p>I'd definitely keep the debruijin setup until the rest is in place, I guess, but it defintiely affects the generic "type family" sort of operations, as you'll need to have notions of shifting and what not --</p>



<a name="178317572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317572">(Oct 16 2019 at 18:46)</a>:</h4>
<p>that said, if we use generics -- we might be abel to make it a compilation time error to forget to shift :)</p>



<a name="178317670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178317670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178317670">(Oct 16 2019 at 18:47)</a>:</h4>
<p>ok, that's about all I've got I guess :) I'll stop here but this is something I really want to start experimenting with asap to "try out". I don't plan to do all the work myself, I'd like to do enough of the steps I'm convinced it will work and then work with someone else (or maybe work with someone else a bit from the start)</p>



<a name="178318136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318136">(Oct 16 2019 at 18:52)</a>:</h4>
<p>re: deBruijn indices the shifting is quite subtle, but if we moved away from it I’d be concerned about performance. Maybe we can introduce some nice abstractions around this, as you mentioned</p>



<a name="178318159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318159">(Oct 16 2019 at 18:53)</a>:</h4>
<p>yeah that's really a separate topic</p>



<a name="178318166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318166">(Oct 16 2019 at 18:53)</a>:</h4>
<p>Both have their performance issues</p>



<a name="178318507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318507">(Oct 16 2019 at 18:57)</a>:</h4>
<p>I’m also curious what we’ve learned about the different concrete type representations you’d want in rustc vs rust-analyzer. Like I know that rustc types are pretty coupled to the internals, but not sure if it <em>has to</em> be that way. </p>
<p>In other words, are generics over type representations the way we would do it if we were starting over, or a way of making migration more feasible?</p>



<a name="178318557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318557">(Oct 16 2019 at 18:58)</a>:</h4>
<p>Some of both</p>



<a name="178318633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318633">(Oct 16 2019 at 18:58)</a>:</h4>
<p>The pros I see is precisely the ability to make these syntactic distinctions</p>



<a name="178318644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318644">(Oct 16 2019 at 18:58)</a>:</h4>
<p>These come up in rustc too, and we've just opted not to have the extra static safety</p>



<a name="178318676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318676">(Oct 16 2019 at 18:59)</a>:</h4>
<p>On the other hand, it does induce <em>some</em> amount of "forced inefficiency" because you can't assume the types are the same, even if you happen to know that (in some particular case) you just want the same type</p>



<a name="178318710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318710">(Oct 16 2019 at 18:59)</a>:</h4>
<p>But I think overall we do an awful amoutn of type folding and "re-interning" in rustc anyway :)</p>



<a name="178318770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318770">(Oct 16 2019 at 19:00)</a>:</h4>
<p>I think what'd I'd prefer is to have the generic layer, and then try to use specialization and/or other tricks to optimize it out where we can</p>



<a name="178318812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318812">(Oct 16 2019 at 19:00)</a>:</h4>
<blockquote>
<p>These come up in rustc too, and we've just opted not to have the extra static safety</p>
</blockquote>
<p>an example:</p>
<ul>
<li>when you extract the type of a field from a struct, that may reference parameters defined on the struct</li>
<li>therefore, you really need to immediately substitute values for those parameters that come from your "current namespace"</li>
<li>but this is not reflected in the type</li>
</ul>



<a name="178318816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318816">(Oct 16 2019 at 19:00)</a>:</h4>
<p>failure to do those substitutions is a common source of ICEs</p>



<a name="178318837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318837">(Oct 16 2019 at 19:01)</a>:</h4>
<p>for that matter, normalization in rustc must also be done at this time, and failure to do that is also a common problem :)</p>



<a name="178318905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178318905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178318905">(Oct 16 2019 at 19:02)</a>:</h4>
<p>it seems to me that having multipe generic types that (when instantiated) wind up sharing the same representation might actually be a kind of "sweet spot"</p>



<a name="178319440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/meeting%202019-10-16/near/178319440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/meeting.202019-10-16.html#178319440">(Oct 16 2019 at 19:09)</a>:</h4>
<p>Yeah I really like that idea, in theory at least <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>